package com.duxiaolie.demobook.web;

import com.duxiaolie.demobook.entity.User;
import com.duxiaolie.demobook.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * @return
     */
    @RequestMapping("/getUsers")
    public List<User> getUserAll() {
        return this.userService.getAllUser();
    }

    /**
     * @param id
     */
    @RequestMapping("/delete/{id}")
    public void delUser(@PathVariable Integer id) {
        this.userService.del(id);
    }
}
